//
//  QDUserCenterTitleTableViewCell.m
//  QDMetroClient
//
//  Created by YueWen on 2019/1/21.
//  Copyright © 2019 YueWen. All rights reserved.
//

#import "QDUCTitleTableViewCell.h"

@implementation QDUCTitleTableViewCell

@synthesize imageView = _imageView;

- (void)buildView {
 
    self.imageView = ({
        
        UIImageView *imageView = [UIImageView new];
        imageView.backgroundColor = UIColor.whiteColor;
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        
        imageView;
    });
    
    self.titleLabel = ({
        
        UILabel *label = [UILabel new];
        label.text = @"支付管理";
        label.font = RITLMediumFont(17);
        label.textColor = QDSColorDefaultBlack;
        label.backgroundColor = [UIColor whiteColor];
        
        label;
    });
    

    
    self.arrowImageView = ({
        
        UIImageView *imageView = [UIImageView new];
        imageView.backgroundColor = UIColor.whiteColor;
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        imageView.image = @"uc_arrow_right".ritl_image;
        
        imageView;
    });
    
    [self.contentView addSubview:self.imageView];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.subtitleLabel];
    [self.contentView addSubview:self.arrowImageView];
}



- (void)buildLayouts {
    
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(20);
        make.centerY.offset(0);
        make.left.offset(23);
    }];
    
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(52);
        make.centerY.offset(0);
        make.height.mas_lessThanOrEqualTo(24);
    }];
    
    [self.subtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.inset(38);
        make.centerY.equalTo(self.titleLabel);
        make.height.mas_lessThanOrEqualTo(17);
    }];
    
    [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(16);
        make.centerY.equalTo(self.titleLabel.mas_centerY);
        make.right.inset(20);
    }];
}


- (UILabel *)subtitleLabel {
    if (!_subtitleLabel) {
        
        UILabel *label = [UILabel new];
        label.backgroundColor = [UIColor whiteColor];
        label.text = @"";
        label.font = RITLLightFont(14);
        label.textColor = QDSColorDefaultGray;
        label.textAlignment = NSTextAlignmentRight;

        _subtitleLabel = label;
    }
    return _subtitleLabel;
}

@end
